package com.garagesale.data;
// Generated May 3, 2011 8:59:20 PM by Hibernate Tools 3.2.1.GA

import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Item generated by hbm2java
 */
@Entity
@Table(name = "item", catalog = "garage_sale")
public class Item implements java.io.Serializable
{

    private Integer itemID;
    private User userBySellerUserId;
    private User userByBuyerUserId;
    private ItemCategory itemCategory;
    private ShoppingCart shoppingCart;
    private String name;
    private String description;
    private BigDecimal salePrice;
    private Date soldDate;
    private Date createdDate;
    private String imageUrl;

    public Item()
    {
    }

    public Item(User userBySellerUserId, String name, String description, BigDecimal salePrice, Date createdDate)
    {
        this.userBySellerUserId = userBySellerUserId;
        this.name = name;
        this.description = description;
        this.salePrice = salePrice;
        this.createdDate = createdDate;
    }

    public Item(User userBySellerUserId, ItemCategory itemCategory, String name, String description, BigDecimal salePrice, Date createdDate, String imageUrl)
    {
        this.userBySellerUserId = userBySellerUserId;
        this.itemCategory = itemCategory;
        this.name = name;
        this.description = description;
        this.salePrice = salePrice;
        this.createdDate = createdDate;
        this.imageUrl = imageUrl;
    }

    

    public Item(User userBySellerUserId, User userByBuyerUserId, ItemCategory itemCategory, ShoppingCart shoppingCart, String name, String description, BigDecimal salePrice, Date soldDate, Date createdDate)
    {
        this.userBySellerUserId = userBySellerUserId;
        this.userByBuyerUserId = userByBuyerUserId;
        this.itemCategory = itemCategory;
        this.shoppingCart = shoppingCart;
        this.name = name;
        this.description = description;
        this.salePrice = salePrice;
        this.soldDate = soldDate;
        this.createdDate = createdDate;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "item_id", unique = true, nullable = false)
    public Integer getItemID()
    {
        return this.itemID;
    }

    public void setItemID(Integer itemId)
    {
        this.itemID = itemId;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "seller_user_id", nullable = false)
    public User getUserBySellerUserId()
    {
        return this.userBySellerUserId;
    }

    public void setUserBySellerUserId(User userBySellerUserId)
    {
        this.userBySellerUserId = userBySellerUserId;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "buyer_user_id")
    public User getUserByBuyerUserId()
    {
        return this.userByBuyerUserId;
    }

    public void setUserByBuyerUserId(User userByBuyerUserId)
    {
        this.userByBuyerUserId = userByBuyerUserId;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "item_category_id")
    public ItemCategory getItemCategory()
    {
        return this.itemCategory;
    }

    public void setItemCategory(ItemCategory itemCategory)
    {
        this.itemCategory = itemCategory;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "shopping_cart_id")
    public ShoppingCart getShoppingCart()
    {
        return this.shoppingCart;
    }

    public void setShoppingCart(ShoppingCart shoppingCart)
    {
        this.shoppingCart = shoppingCart;
    }

    @Column(name = "name", nullable = false, length = 45)
    public String getName()
    {
        return this.name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    @Column(name = "description", nullable = false, length = 45)
    public String getDescription()
    {
        return this.description;
    }

    public void setDescription(String description)
    {
        this.description = description;
    }

    @Column(name = "sale_price", nullable = false, precision = 10)
    public BigDecimal getSalePrice()
    {
        return this.salePrice;
    }

    public void setSalePrice(BigDecimal salePrice)
    {
        this.salePrice = salePrice;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "sold_date", length = 0)
    public Date getSoldDate()
    {
        return this.soldDate;
    }

    public void setSoldDate(Date soldDate)
    {
        this.soldDate = soldDate;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "created_date", nullable = false, length = 0)
    public Date getCreatedDate()
    {
        return this.createdDate;
    }

    public void setCreatedDate(Date createdDate)
    {
        this.createdDate = createdDate;
    }

    @Column(name = "imageUrl", nullable = true, length = 256)
    public String getImageUrl()
    {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl)
    {
        this.imageUrl = imageUrl;
    }
}
